package com.roc.web.action.settlemgr;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class TemStrongDeductionSearchCondition extends BaseSearchCondition {
	private String mchtCd;
	private String mchtName;
	private String accountNo;
	private String applyDateMin;
	private String applyDateMax;
	private String org;
	private String nature;// 对公对私性质
	private String type;// 出款类型

	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		// 商户号
		if (Constance.isNotEmpty(mchtCd)) {
			filedBeanList.add(new WhereHQLFieldBean("s.mcht_cd", mchtCd.trim(),
					"=", false));
		}

		if (Constance.isNotEmpty(mchtName)) {
			filedBeanList.add(new WhereHQLFieldBean("s.mcht_name", mchtName
					.trim(), "LIKE", false, "ALL"));
		}
		if (Constance.isNotEmpty(accountNo)) {
			filedBeanList.add(new WhereHQLFieldBean("s.account", accountNo
					.trim(), "=", false));
		}

		if (Constance.isNotEmpty(applyDateMin)) {
			filedBeanList.add(new WhereHQLFieldBean("s.settledate",
					applyDateMin.trim(), ">=", false));
		}
		if (Constance.isNotEmpty(applyDateMax)) {
			filedBeanList.add(new WhereHQLFieldBean("s.settledate",
					applyDateMax.trim(), "<=", false));
		}
		if (Constance.isNotEmpty(org)) {
			filedBeanList.add(new WhereHQLFieldBean("s.ins_id_cd", org.trim(),
					"=", false));
		}
		if (Constance.isNotEmpty(nature)) {
			filedBeanList.add(new WhereHQLFieldBean("s.acc_type",
					nature.trim(), "=", false));
		}
		if (Constance.isNotEmpty(type)) {
			filedBeanList.add(new WhereHQLFieldBean("s.remark", type.trim(),
					"=", false));
		}
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append("select count(*) from t_settle_item s where settleflag='1'");
		return sb.toString();
	}

	@Override
	protected String getSearchHQL() {
		StringBuffer sb = new StringBuffer();
		sb.append("select s.id,s.ins_id_cd,s.mcht_cd,s.mcht_name,s.trans_amt,s.total_num,s.mcht_fee,s.mcht_set_amt,s.bank_name,s.bank_code,s.account,s.account_name,s.acc_type,s.settledate,s.settleflag,s.setdate,s.freezeflag,s.dt_create,s.dt_update,s.freeze_amt,s.un_freeze_amt,s.remark1,s.remark from t_settle_item s where settleflag='1'");
		return sb.toString();
	}

	@Override
	protected String getOrderPartOfHQL() {
		return "order by s.dt_create desc";
	}

	public String getMchtCd() {
		return mchtCd;
	}

	public void setMchtCd(String mchtCd) {
		this.mchtCd = mchtCd;
	}

	public String getMchtName() {
		return mchtName;
	}

	public void setMchtName(String mchtName) {
		this.mchtName = mchtName;
	}

	public String getAccountNo() {
		return accountNo;
	}

	public void setAccountNo(String accountNo) {
		this.accountNo = accountNo;
	}

	public String getApplyDateMin() {
		return applyDateMin;
	}

	public void setApplyDateMin(String applyDateMin) {
		this.applyDateMin = applyDateMin;
	}

	public String getApplyDateMax() {
		return applyDateMax;
	}

	public void setApplyDateMax(String applyDateMax) {
		this.applyDateMax = applyDateMax;
	}

	public String getOrg() {
		return org;
	}

	public void setOrg(String org) {
		this.org = org;
	}

	public String getNature() {
		return nature;
	}

	public void setNature(String nature) {
		this.nature = nature;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
}
